using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Content - 内容表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleContent<T> :ModelBase<ArticleContent> where T : ArticleContent, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.ContentId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return ContentId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.ContentId=dy.ContentId;
           this.UserId=dy.UserId;
           this.Title=dy.Title;
           this.ArticleTypeid=dy.ArticleTypeid;
           this.TemplateId=dy.TemplateId;
           this.State=dy.State;
           this.KeyWords=dy.KeyWords;
           this.Summary=dy.Summary;
           this.FileId=dy.FileId;
           this.Click=dy.Click;
           this.Recommend=dy.Recommend;
           this.TopNum=dy.TopNum;
           this.IsComment=dy.IsComment;
           this.IsImage=dy.IsImage;
           this.IsLogin=dy.IsLogin;
           this.SubmitTime=dy.SubmitTime;
           this.UpateTime=dy.UpateTime;
           this.OverTime=dy.OverTime;
           this.CommentNum=dy.CommentNum;
        } 

        #region 定义属性

     
         /// <summary>
        /// Rowid
        /// </summary>
        private String _ContentId = "";
      
        /// <summary>
        /// Rowid
        /// </summary>
        public String ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 发布人ID
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 发布人ID
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 标题
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 标题
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 所属分类
        /// </summary>
        private int _ArticleTypeid =int.MinValue;
      
        /// <summary>
        /// 所属分类
        /// </summary>
        public int ArticleTypeid
        {
            get 
            {
              return   (this._ArticleTypeid); 
            }

            set 
            {
                    _ArticleTypeid= value;  
            }
        }
       
     
         /// <summary>
        /// 模版类别
        /// </summary>
        private int _TemplateId =-1;
      
        /// <summary>
        /// 模版类别
        /// </summary>
        public yq.Enums.ArticleContent.TemplateId TemplateId
        {
            get 
            {
              return   (yq.Enums.ArticleContent.TemplateId)this._TemplateId;  
            }

            set 
            {
                    _TemplateId= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 状态
        /// </summary>
        private int _State =-1;
      
        /// <summary>
        /// 状态
        /// </summary>
        public yq.Enums.ArticleContent.State State
        {
            get 
            {
              return   (yq.Enums.ArticleContent.State)this._State;  
            }

            set 
            {
                    _State= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 关键字
        /// </summary>
        private String _KeyWords = "";
      
        /// <summary>
        /// 关键字
        /// </summary>
        public String KeyWords
        {
            get 
            {
              return   (this._KeyWords); 
            }

            set 
            {
                    _KeyWords= value;  
            }
        }
       
     
         /// <summary>
        /// 摘要
        /// </summary>
        private String _Summary = "";
      
        /// <summary>
        /// 摘要
        /// </summary>
        public String Summary
        {
            get 
            {
              return   (this._Summary); 
            }

            set 
            {
                    _Summary= value;  
            }
        }
       
     
         /// <summary>
        /// 图片ID
        /// </summary>
        private String _FileId = "";
      
        /// <summary>
        /// 图片ID
        /// </summary>
        public String FileId
        {
            get 
            {
              return   (this._FileId); 
            }

            set 
            {
                    _FileId= value;  
            }
        }
       
     
         /// <summary>
        /// 点击率
        /// </summary>
        private int _Click =int.MinValue;
      
        /// <summary>
        /// 点击率
        /// </summary>
        public int Click
        {
            get 
            {
              return   (this._Click); 
            }

            set 
            {
                    _Click= value;  
            }
        }
       
     
         /// <summary>
        /// 推荐度
        /// </summary>
        private int _Recommend =int.MinValue;
      
        /// <summary>
        /// 推荐度
        /// </summary>
        public int Recommend
        {
            get 
            {
              return   (this._Recommend); 
            }

            set 
            {
                    _Recommend= value;  
            }
        }
       
     
         /// <summary>
        /// 置顶级别
        /// </summary>
        private int _TopNum =int.MinValue;
      
        /// <summary>
        /// 置顶级别
        /// </summary>
        public int TopNum
        {
            get 
            {
              return   (this._TopNum); 
            }

            set 
            {
                    _TopNum= value;  
            }
        }
       
     
         /// <summary>
        /// 是否开启评论
        /// </summary>
        private int _IsComment =-1;
      
        /// <summary>
        /// 是否开启评论
        /// </summary>
        public yq.Enums.BooleanType IsComment
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsComment; 
            }

            set 
            {
                    _IsComment= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否包含图片
        /// </summary>
        private int _IsImage =-1;
      
        /// <summary>
        /// 是否包含图片
        /// </summary>
        public yq.Enums.BooleanType IsImage
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsImage; 
            }

            set 
            {
                    _IsImage= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否登录才能浏览
        /// </summary>
        private int _IsLogin =-1;
      
        /// <summary>
        /// 是否登录才能浏览
        /// </summary>
        public yq.Enums.BooleanType IsLogin
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsLogin; 
            }

            set 
            {
                    _IsLogin= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 发布时间
        /// </summary>
        private DateTime _SubmitTime =DateTime.MinValue;
      
        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime SubmitTime
        {
            get 
            {
              return   (this._SubmitTime); 
            }

            set 
            {
                    _SubmitTime= value;  
            }
        }
       
     
         /// <summary>
        /// 修改时间
        /// </summary>
        private DateTime _UpateTime =DateTime.MinValue;
      
        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime UpateTime
        {
            get 
            {
              return   (this._UpateTime); 
            }

            set 
            {
                    _UpateTime= value;  
            }
        }
       
     
         /// <summary>
        /// 结束时间
        /// </summary>
        private DateTime _OverTime =DateTime.MinValue;
      
        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime OverTime
        {
            get 
            {
              return   (this._OverTime); 
            }

            set 
            {
                    _OverTime= value;  
            }
        }
       
     
         /// <summary>
        /// 评论数量
        /// </summary>
        private int _CommentNum =int.MinValue;
      
        /// <summary>
        /// 评论数量
        /// </summary>
        public int CommentNum
        {
            get 
            {
              return   (this._CommentNum); 
            }

            set 
            {
                    _CommentNum= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleContent info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=row["ContentId"].ToString();
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["ArticleTypeid"]!= DBNull.Value)
                  {
                  info.ArticleTypeid=Convert.ToInt32(row["ArticleTypeid"]);
                 }
                 
                  
                  if(row["TemplateId"]!= DBNull.Value)
                  {
                  info.TemplateId=  (yq.Enums.ArticleContent.TemplateId)(row["TemplateId"]) ;
                 }
                 
                  
                  if(row["State"]!= DBNull.Value)
                  {
                  info.State=  (yq.Enums.ArticleContent.State)(row["State"]) ;
                 }
                 
                  
                  if(row["KeyWords"]!= DBNull.Value)
                  {
                  info.KeyWords=row["KeyWords"].ToString();
                 }
                 
                  
                  if(row["Summary"]!= DBNull.Value)
                  {
                  info.Summary=row["Summary"].ToString();
                 }
                 
                  
                  if(row["FileId"]!= DBNull.Value)
                  {
                  info.FileId=row["FileId"].ToString();
                 }
                 
                  
                  if(row["Click"]!= DBNull.Value)
                  {
                  info.Click=Convert.ToInt32(row["Click"]);
                 }
                 
                  
                  if(row["Recommend"]!= DBNull.Value)
                  {
                  info.Recommend=Convert.ToInt32(row["Recommend"]);
                 }
                 
                  
                  if(row["TopNum"]!= DBNull.Value)
                  {
                  info.TopNum=Convert.ToInt32(row["TopNum"]);
                 }
                 
                  
                  if(row["IsComment"]!= DBNull.Value)
                  {
                  info.IsComment= (yq.Enums.BooleanType)(row["IsComment"]) ;
                 }
                 
                  
                  if(row["IsImage"]!= DBNull.Value)
                  {
                  info.IsImage= (yq.Enums.BooleanType)(row["IsImage"]) ;
                 }
                 
                  
                  if(row["IsLogin"]!= DBNull.Value)
                  {
                  info.IsLogin= (yq.Enums.BooleanType)(row["IsLogin"]) ;
                 }
                 
                  
                  if(row["SubmitTime"]!= DBNull.Value)
                  {
                  info.SubmitTime=Convert.ToDateTime(row["SubmitTime"]);
                 }
                 
                  
                  if(row["UpateTime"]!= DBNull.Value)
                  {
                  info.UpateTime=Convert.ToDateTime(row["UpateTime"]);
                 }
                 
                  
                  if(row["OverTime"]!= DBNull.Value)
                  {
                  info.OverTime=Convert.ToDateTime(row["OverTime"]);
                 }
                 
                  
                  if(row["CommentNum"]!= DBNull.Value)
                  {
                  info.CommentNum=Convert.ToInt32(row["CommentNum"]);
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleContent info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@ContentId", DbType.String,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@ArticleTypeid", DbType.Int32,ParameterTool.GetObj( info._ArticleTypeid )); 
            
             
                cn.AddInParameter(comm, "@TemplateId", DbType.Int32,ParameterTool.GetObj( info._TemplateId )); 
            
             
                cn.AddInParameter(comm, "@State", DbType.Int32,ParameterTool.GetObj( info._State )); 
            
             
                cn.AddInParameter(comm, "@KeyWords", DbType.String,ParameterTool.GetObj( info._KeyWords )); 
            
             
                cn.AddInParameter(comm, "@Summary", DbType.String,ParameterTool.GetObj( info._Summary )); 
            
             
                cn.AddInParameter(comm, "@FileId", DbType.String,ParameterTool.GetObj( info._FileId )); 
            
             
                cn.AddInParameter(comm, "@Click", DbType.Int32,ParameterTool.GetObj( info._Click )); 
            
             
                cn.AddInParameter(comm, "@Recommend", DbType.Int32,ParameterTool.GetObj( info._Recommend )); 
            
             
                cn.AddInParameter(comm, "@TopNum", DbType.Int32,ParameterTool.GetObj( info._TopNum )); 
            
             
                cn.AddInParameter(comm, "@IsComment", DbType.Int32,ParameterTool.GetObj( info._IsComment )); 
            
             
                cn.AddInParameter(comm, "@IsImage", DbType.Int32,ParameterTool.GetObj( info._IsImage )); 
            
             
                cn.AddInParameter(comm, "@IsLogin", DbType.Int32,ParameterTool.GetObj( info._IsLogin )); 
            
             
                cn.AddInParameter(comm, "@SubmitTime", DbType.DateTime,ParameterTool.GetObj( info._SubmitTime )); 
            
             
                cn.AddInParameter(comm, "@UpateTime", DbType.DateTime,ParameterTool.GetObj( info._UpateTime )); 
            
             
                cn.AddInParameter(comm, "@OverTime", DbType.DateTime,ParameterTool.GetObj( info._OverTime )); 
            
             
                cn.AddInParameter(comm, "@CommentNum", DbType.Int32,ParameterTool.GetObj( info._CommentNum )); 
            
        } 

    } 
} 